Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Lookup generics. #1079

Merged
merged 1 commit into from
Jul 28, 2022
Merged

Support Lookup generics. #1079

merged 1 commit into from
Jul 28, 2022

Conversation

PIG208
Copy link
Contributor

@PIG208 PIG208 commented Jul 28, 2022

I have made things!

Custom Lookup implementation will run into
'Missing type parameters for generic type "Lookup"' without having
Lookup monkey-patched with django-stubs-ext.

Related issues

Custom `Lookup` implementation will run into
'Missing type parameters for generic type "Lookup"' without having
`Lookup` monkey-patched with django-stubs-ext.

Signed-off-by: Zixuan James Li <[email protected]>
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Are interested in automating this check (that types marked as Generic either support __class_getitem__ or are monkey-patched)?
Because we have this problem all the time.

@sobolevn sobolevn merged commit 0e9ebf8 into typeddjango:master Jul 28, 2022
@PIG208
Copy link
Contributor Author

PIG208 commented Jul 28, 2022

Sounds interesting. Is there a mechanism for us to find all the types that are marked as Generic? Starting from there, the check shouldn't be too complicated to implement.

@sobolevn
Copy link
Member

Yes, we can use ast module for that. For example, some different check: https://github.com/wemake-services/wemake-python-styleguide/blob/master/scripts/check_generic_visit.py

@PIG208 PIG208 deleted the lookup branch July 28, 2022 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants